
/**
 * This is a very simple program designed to demostrate that MTASC is building
 * correctly.
 * http://www.mtasc.org/
 * 
 * MTasc Arguments are:
 * 
 * FLASH7
 *  -swf build/MTASCTest.swf -main -header 800:600:20 
 * or
 * FLASH8
 *  -swf build/MTASCTest.swf -main -header 800:600:20 -version 8
 *  
 * Here's a full blown one for command line.
 *   C:\DATA_SYNC\CodeProjects\mtasc-1.12\mtasc.exe -swf build/MTASCTest.swf -main -header 800:600:20    -cp "C:\DATA_SYNC\CodeProjects\workspace\TroyWorks - dev\src"  -cp "C:\DATA_SYNC\CodeProjects\Actionscript AS 2.0\lib"  -cp "C:\DATA_SYNC\CodeProjects\workspace\TroyWorks - tests\src"  -cp C:\DATA_SYNC\CodeProjects\mtasc-1.12\std  MTascTest
 * 
 * 
 * MMC arguments are
 *  CODE:
  import MTASC_SOS_Test;
  MTASC_SOS_Test.main(this);
 * @author Troy Gardner
 */
class MTASC_SOS_Test {

	static var app : MTASC_SOS_Test;
	//necessary to include for compiliation.
	function MTASC_SOS_Test() {
		// creates a 'tf' TextField size 800x600 at pos 0,0
		_root.createTextField("tf",0,0,0,800,600);
		// write some text into it
		_root.tf.text = "Hello world ! \r Socket Connect?:";
	}

	// entry point
	static function main(mc:MovieClip):Void {
		app = new MTASC_SOS_Test();
		// connect to the sos  XML Socket logger, 
		//NOTE we have to add it to the root to keep a reference past main to work
		//http://lists.motion-twin.com/pipermail/mtasc/2005-June/026633.html
		var sock:XMLSocket = new XMLSocket();
		sock.onConnect= function(success:Boolean):Void{
			_root.tf.text += "X" + success;
		};
		
		sock.connect("localhost",4444); //if clear on connect true, the SOS screen should clear
		sock.send("sos connected " + (new Date()).toString());// should see something like sos connected Fri Jan 5 23:59:25 GMT-0800 2007
		_root.sock = sock;		

		mc.createTextField("tf2",1,40,40,800,600);
		// write some text into it
		mc.tf2.text = "Sock " + sock + " \r From" + mc._name + " _url:" + mc._url ;
		mc.tf2.text += "\r\r\r check the SOS output you should see something like \r\t sos connected Fri Jan 5 23:55:48 GMT-0800 2007";

	}
}